package lab1;
public class BaiTap1 {

	private long sotk;
	private String tentk;
	private double sotien;
	private double laisuat = 0.02;
	private double napvao;
	private double rutra=0;
	private double phi =5;
	private double chuyenkhoan;
	public long getSotk() {
		return sotk;
	}

	public void setSotk(long sotk) {
		this.sotk = sotk;
	}

	public String getTentk() {
		return tentk;
		
	}

	public void setTentk(String tentk) {
		this.tentk = tentk;
	}

	public double getSotien() {
		return sotien;
	}

	public void setSotien(double sotien) {
		this.sotien = sotien;
	}
	
	
	public double getNapvao() {
		return napvao;
	}

	public void setNapvao(double napvao) {
		this.napvao = napvao;
		this.NapTien();
	}

	public double getRutra() {
		return rutra;
	}

	public void setRutra(double rutra) {
		this.rutra = rutra;
		this.RutTien();
	}

	public double getChuyenkhoan() {
		return chuyenkhoan;
	}

	public void setChuyenkhoan(double chuyenkhoan) {
		this.chuyenkhoan = chuyenkhoan;
	}
	
	@Override
	public String toString() {
		return "Account [sotk=" + sotk + ", tentk=" + tentk + ", sotien="
				+ sotien + "]";
	}

	public BaiTap1(){
		this.sotk=0;
		this.tentk=null;
		this.sotien=100;
	}
	
	public BaiTap1(long sotk , String tentk)
	{
		this.sotk=sotk;
		this.tentk=tentk;
		this.sotien=100;
	}
	
	
	public void NapTien()
	{
		this.sotien= this.sotien + this.napvao;
	}
	
	public void RutTien()
	{
		if(sotien-rutra-phi < 100)
			System.out.println("Giao dichn rut tien khong hop le");
		else 
			sotien=sotien-(rutra + phi);
	}
	
	public void DaoHan()
	{
		this.sotien= this.sotien + this.sotien*laisuat;
	}
	
	public void ChuyenKhoan(BaiTap1 a , BaiTap1 b)
	{
		a.sotien = a.sotien - chuyenkhoan;
		b.sotien = b.sotien + chuyenkhoan;
	}
	public static void  main(String[] args)
	{
		BaiTap1 acc1 = new BaiTap1(001,"KiTuDu");
		BaiTap1 acc2 = new BaiTap1(002,"SuZuKi");
		acc1.setNapvao(50);
		acc1.setRutra(30);
		acc1.setChuyenkhoan(10);
		acc1.ChuyenKhoan(acc1,acc2);
		acc1.DaoHan();
		System.out.println("Account1   [   sotk  =   " + acc1.sotk + " , tentk  = " + acc1.tentk + "  , sotien  =  "
				+ acc1.sotien + "    ]");
	
		System.out.println("Account2   [   sotk  =   " + acc2.sotk + " , tentk  = " + acc2.tentk + "  , sotien  =  "
				+ acc2.sotien + "    ]");
	}

	
}
